import diff from "./diff"

export default class Component {
    constructor(props) {
        this.props = props || {}
    }
    setState(state) {
        this.state = Object.assign(this.state, state)
        let oldDOM = this.getDOM()
        let virtualDOM = this.render()
        diff(virtualDOM, oldDOM.parentNode, oldDOM)
    }
    setDOM(dom) {
        this._dom = dom
    }
    getDOM() {
        return this._dom
    }
    componentWillReceiveProps(nextProps) {

    }
    shouldComponentUpdate(nextProps, nextState) {
        return nextProps !== this.props || nextState !== this.state
    }
    componentWillMount() {

    }
    componentDidMount() {

    }
    componentWillUpdate() {

    }
    componentDidUpdate() {

    }
    componentWillUnMount() {

    }
    updateProps(props) {
        this.props = props
    }
}